<template>
  <div>
    <div class="header">
      <div class="header-left">
        <span>返回</span>
        <img src="@/assets/img/arrow-lift.png" />
      </div>
      <div class="header-input">
        <span>输入城市/景点/游玩主题</span>
        <img src="@/assets/img/search.png" />
      </div>
      <router-link to="/city">
        <div class="header-right ellipsis">
          <span>{{this.city}}</span>
          <!-- <span>{{this.doubleCity}}</span> -->
          <img src="@/assets/img/arrowDown.png" />
        </div>
      </router-link>
    </div>
  </div>
</template>
<script>
import axios from 'axios'
import {mapState} from 'vuex' //优化 this.$store.state.city
// import {mapGetters} from 'vuex'//getter的用法
export default {
  name: "home",
  //计算属性
  computed :{
      ...mapState(['city']),
      // ...mapGetters(['doubleCity'])
  },
  data(){
    return {
      // city:''
    }
  },
  // 第三步
  created(){
    // this.getHomeInfo()
  },
  methods:{
    //  getHomeInfo(){
    //       axios.get('/api/index.json?city=' + this.city).then((res) =>{
    //           // this.city=res.data.city
    //       })
    //   }
  },

};
</script>
<style  scoped>
.header,
.header {
  background: #00bcd4;
  color: #fff;
  display: flex;
  font-size: 12px;
  line-height: 43px;
}

.header .header-left {
  margin-left:4px; 
  width: 32px;
}
.header .header-left span {
  margin-left: 8px;
}
.header .header-left img {
  width:26px;
  /* height:26px; */
  position: absolute;
  left: -8px;
  top: 8px;
  opacity: 0.8;
}
.header .header-input {
  /* width: 90%; */
  flex: 1;
  background: #fff;
  border-radius: 5px;
  margin: 6px 0 6px 5px;
  height: 32px;
  color: #cccccc;
  text-align: center;
  line-height: 32px;
}
.header .header-input img {
  width: 16px;
  height: 16px;
  position: absolute;
  left: 20%;
  top: 14px;
  opacity: 0.8;
}
.header .header-right {
  /* padding-right:-15px; */
  /* width: 60px; */
  text-align: center;
  margin-right: 18px;
  text-indent: 8px;
  color: #fff
}
.header .header-right img {
  width: 14px;
  height: 14px;
  position: absolute;
  top: 14px;
  right:2px;
}
</style>